package org.hiberlyzer.impl;

import java.io.Serializable;

import org.hiberlyzer.DataSource;
import org.hiberlyzer.DataSourceFactory;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

public class DataSourceFactoryImpl implements DataSourceFactory, Serializable
{
	private static final long serialVersionUID = 1L;
	private SessionFactory _factory;
	
	public DataSourceFactoryImpl(SessionFactory sessionFactory)
	{
		this._factory = sessionFactory;
	}
	
	public DataSource acquireDataSource()
	{
		Session session = _factory.openSession();
		return new DataSourceImpl(session);
	}
}
